<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改客户')" />
    <style>
        .avatar{
            text-align: center;
            margin: 20px;
        }
        .form-group{
            display: inline-flex;
            width: 100%;
        }
    </style>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-client-edit" th:object="${client}">
            <div class="avatar">
                <img th:src="*{avatarUrl}"><br/>
                <label th:text="*{nickName}"></label>
            </div>
            <input name="clientId" th:field="*{clientId}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">电话：</label>
                <div class="col-sm-8">
                    <input name="phone" th:field="*{phone}" class="form-control" type="text" readonly="readonly">
                </div>
                <label class="col-sm-3 control-label">邮箱：</label>
                <div class="col-sm-8">
                    <input name="nickName" th:field="*{email}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">性别：</label>
                <div class="col-sm-8">
                    <select name="gender" class="form-control" disabled="disabled">
                        <option value="0" th:selected="${client.gender == '0'}">未知</option>
                        <option value="1" th:selected="${client.gender == '1'}">男</option>
                        <option value="2" th:selected="${client.gender == '2'}">女</option>
                    </select>
                </div>
                <label class="col-sm-3 control-label">国家：</label>
                <div class="col-sm-8">
                    <input name="conuntry" th:field="*{conuntry}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">省：</label>
                <div class="col-sm-8">
                    <input name="province" th:field="*{province}" class="form-control" type="text" readonly="readonly">
                </div>
                <label class="col-sm-3 control-label">城市：</label>
                <div class="col-sm-8">
                    <input name="city" th:field="*{city}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">生日：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="joinDate" th:value="${#dates.format(client.birthday, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" readonly="readonly">
                    </div>
                </div>
                <label class="col-sm-3 control-label">加入的日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="joinDate" th:value="${#dates.format(client.joinDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" readonly="readonly">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">等级：</label>
                <div class="col-sm-8">
                    <select name="gradeId" class="form-control">
                        <option th:each="item : ${grades}" th:value="${item.gradeId}" th:text="${item.gradeName}" th:selected="${client.gradeId == item.gradeId}"></option>
                    </select>
                </div>
                <label class="col-sm-3 control-label">余额：</label>
                <div class="col-sm-8">
                    <input name="money" th:field="${client.money}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">积分：</label>
                <div class="col-sm-8">
                    <input name="province" th:field="${client.integral}" class="form-control" type="text">
                </div>
                <label class="col-sm-3 control-label">充值额：</label>
                <div class="col-sm-8">
                    <input name="city" th:field="${client.investMoney}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "weixin/client";
        $("#form-client-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-client-edit').serialize());
            }
        }
    </script>
</body>
</html>